package com.zhongxiangspace.service.impl;


import com.zhongxiangspace.entity.OfficeCreepData;
import com.zhongxiangspace.mapper.OfficeCreepDataMapper;
import com.zhongxiangspace.service.OfficeCreepDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 写字楼data
 */
@Service
public class OfficeCreepDataServiceImpl implements OfficeCreepDataService {

    @Autowired
    private OfficeCreepDataMapper officeCreepDataMapper;

    /**
     * 添加写字楼data
     * @param officeCreepData
     * @return
     */
    @Override
    @Transactional
    public boolean add(OfficeCreepData officeCreepData) {
        return this.officeCreepDataMapper.add(officeCreepData);
    }

    /**
     * 根据URL获取数据
     * @param url
     * @return
     */
    @Override
    public List<OfficeCreepData> queryByCreepUrl(String url) {
        return this.officeCreepDataMapper.queryByCreepUrl(url);
    }

    /**
     * 更新商铺详情数据
     * @param officeCreepData
     * @return
     */
    @Override
    @Transactional
    public boolean updateOfficeCreepData(OfficeCreepData officeCreepData) {
        return this.officeCreepDataMapper.updateOfficeCreepData(officeCreepData);
    }

    /**
     * 根据区域获取没有爬取页面的数据
     * @param place
     * @return
     */
    @Override
    public List<OfficeCreepData> queryDetailNull(String place) {
        return this.officeCreepDataMapper.queryDetailNull(place);
    }

    /**
     * 更具区域获取写字楼信息
     * @param place
     * @return
     */
    @Override
    public List<OfficeCreepData> queryPlace(String place) {
        System.out.println(place);
        return this.officeCreepDataMapper.queryPlace(place);
    }
}
